package com.shangguigu.crud.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.shangguigu.crud.bean.Department;
import com.shangguigu.crud.bean.msg;
import com.shangguigu.crud.service.DeptService;

/**
 * 处理和部门有关的请求
 * @author 凌熬
 *
 */
@Controller
public class deptController {
	@Autowired
	private DeptService deptservcie;
	/**
	 * 返回所有的部门信息
	 */
	@RequestMapping("/depts")
	@ResponseBody
	public msg getdepts() {
		System.out.println("查询部门");
		//查出的所有部门信息
		List<Department> getdepts = deptservcie.getdepts();
		return  msg.success().add("depts", getdepts) ;
	}
}

